package com.example.demo.controller;

import com.example.demo.entity.Hospital;
import com.example.demo.service.HospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin(origins = "http://localhost:8080")
@RequestMapping("/hospital")
public class HospitalController {
    @Autowired
    private HospitalService hospitalService;
    @GetMapping("/allList")
    public List<Hospital> getHospitalList(){
        return hospitalService.getAllHospital();
    }
    @GetMapping("/getListByName")
    public List<Hospital> getHospitalListByName(String Name){
        return hospitalService.getHospitalByName(Name);
    }

}
